﻿package mortal.game.view.interfaceCallModule
{
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.component.window.*;
    import mortal.game.view.common.*;
    import mortal.mvc.interfaces.*;

    public class UITrackPanel extends SmallWindow
    {
        protected var _tab:GTabBar;
        private var _panel1:UITrackPanelSub1;
        private var _panel2:UITrackPanelSub2;
        private var _curP:GSprite;

        public function UITrackPanel(param1:ILayer = null)
        {
            super(param1);
            titleHeight = 22;
            setSize(580, 600);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:Array = [];
            _loc_1.push({name:"GTextFiled", label:"GTextFiled"});
            _loc_1.push({name:"GButton", label:"GButton"});
            this._tab = UIFactory.gTabBar(25, 48, _loc_1, 63, 22, this, this.onTabBarChangeHandler);
            this._panel1 = UIFactory.getUICompoment(UITrackPanelSub1, 0, 0, this);
            this._panel1.visible = false;
            this._panel2 = UIFactory.getUICompoment(UITrackPanelSub2, 0, 0, this);
            this._panel2.visible = false;
            this._tab.selectedIndex = 0;
            this.onTabBarChangeHandler();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._tab = null;
            this._panel1 = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function onTabBarChangeHandler(event:Event = null) : void
        {
            var _loc_2:* = this._tab.dataProvider[this._tab.selectedIndex];
            if (this._curP)
            {
                this._curP.visible = false;
            }
            this._curP = this["_panel" + (this._tab.selectedIndex + 1)];
            if (this._curP)
            {
                this._curP.visible = true;
            }
            return;
        }// end function

    }
}
